#ifndef __SHT31__
#define	__SHT31__

#include "freertos/FreeRTOS.h"

#define SHT3X_DeviceAddr           (0x44<<1)
#define SHT31_MEAS_HIGHREP_STRETCH 0x2C06
#define SHT31_MEAS_MEDREP_STRETCH  0x2C0D
#define SHT31_MEAS_LOWREP_STRETCH  0x2C10
#define SHT31_MEAS_HIGHREP         0x2400
#define SHT31_MEAS_MEDREP          0x240B
#define SHT31_MEAS_LOWREP          0x2416
#define SHT31_READSTATUS           0xF32D
#define SHT31_CLEARSTATUS          0x3041
#define SHT31_SOFTRESET            0x30A2
#define SHT31_HEATEREN             0x306D
#define SHT31_HEATERDIS            0x3066

/* 单次测量模式
命名格式：Repeatability_CS_CMD
CS： Clock stretching */
#define SHT31_HIGH_ENABLED_CMD        0x2C06
#define SHT31_MEDIUM_ENABLED_CMD      0x2C0D
#define SHT31_LOW_ENABLED_CMD         0x2C10
#define SHT31_HIGH_DISABLED_CMD       0x2400
#define SHT31_MEDIUM_DISABLED_CMD     0x240B
#define SHT31_LOW_DISABLED_CMD        0x2416

/* 周期测量模式
命名格式：Repeatability_MPS_CMD
MPS：measurement per second */
#define SHT31_HIGH_0_5_CMD       0x2032
#define SHT31_MEDIUM_0_5_CMD     0x2024
#define SHT31_LOW_0_5_CMD        0x202F
#define SHT31_HIGH_1_CMD         0x2130
#define SHT31_MEDIUM_1_CMD       0x2126
#define SHT31_LOW_1_CMD          0x212D
#define SHT31_HIGH_2_CMD         0x2236
#define SHT31_MEDIUM_2_CMD       0x2220
#define SHT31_LOW_2_CMD          0x222B
#define SHT31_HIGH_4_CMD         0x2334
#define SHT31_MEDIUM_4_CMD       0x2322
#define SHT31_LOW_4_CMD          0x2329
#define SHT31_HIGH_10_CMD        0x2737
#define SHT31_MEDIUM_10_CMD      0x2721
#define SHT31_LOW_10_CMD         0x272A

/* 周期测量模式读取数据命令 */
#define SHT31_READOUT_FOR_PERIODIC_MODE  0xE000
/* 读取传感器编号命令 */
#define SHT31_READ_SERIAL_NUMBER   0x3780

void SHT31_ModeSet(void);
uint8_t SHT31_ReadTempHum(float data[]);

#endif
